#ifndef __PVMVOICESOURCEWAV_H__
#define __PVMVOICESOURCEWAV_H__

#include "pvm/pvmapi.h"

#include "lib/pvmvoicesource.h"
#include "lib/decoders/wav/pvmdatasourcewav.h"

#include "lib/memory/pvmmemory.h"

class PVMVoiceSourceWAV : public IPVMVoiceSource, public PVMAllocableObject
{
protected:
	PVMVoiceSourceWAV();
public:
	virtual ~PVMVoiceSourceWAV();

	virtual IPVMVoice* CreateVoice(pvm_int samplesPerSecond, pvm_int bitsPerSample, pvm_int chanelsNum);
	virtual void Destroy();
	virtual pvm_int GetLengthMS();

	virtual pvm_bool GetOption(const pvm_char* optionName, void* optionVal, pvm_uint32* optionSize);
	virtual pvm_bool SetOption(const pvm_char* optionName, void* optionVal, pvm_uint32 optionSize);
public:
	static PVMVoiceSourceWAV* Create(IPvmInStream* inStream, pvm_int8* initialData, pvm_uint initialSize, 
									pvm_uint dataOffset, pvm_uint dataSize, FmtHeader& formatHeader);
protected:
	PVMDataSourceWAV*	dataSource;
	PVMCriticalSection	critical;
};

#endif
